﻿using Direct.IDAL;
using DirectSell.IBLL;
using DirectSell.Model.User;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DirectSell.BLL
{
    /// <summary>
    /// 用户服务层
    /// </summary>
    public abstract class UserService : BaseService, IOperation
    {
        #region 日志记录--郭文昊--2018年10月7日21:10:17
        /// <summary>
        /// 日志记录文件
        /// </summary>
        protected override string LogFile => "UserService";
        /// <summary>
        /// 日志记录文件夹
        /// </summary>
        protected override string LogFolder => "UserService";


        #endregion

        #region 用户操作入口--郭文昊--2018年8月19日13:48:30
        /// <summary>
        /// 用户操作入口
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        public UserRespCode DoOperation<T>(T param)
        {
            return Operation<T>(param);
        }
        /// <summary>
        /// 用户操作入--异步
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task<UserRespCode> DoOperationAsync<T>(T param)
        {
            return await OperationAsync<T>(param);
        }

        #endregion

        #region 用户操作虚方法--郭文昊--2018年8月19日05:03:33
        /// <summary>
        /// 用户操作虚方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        protected virtual UserRespCode Operation<T>(T param)
        {
            return UserRespCode.成功;
        }

        protected async virtual Task<UserRespCode> OperationAsync<T>(T param)
        {
            return await Task.Run(()=> UserRespCode.失败);
        }

        #endregion
    }
}
